#ifndef TIMESILCE_H
#define TIMESILCE_H

#include "smlist.h"
typedef enum { TASK_STOP, TASK_RUN } IsTaskRun;

typedef struct timesilce {
  unsigned int id;
  void (*task_hdl)(void);
  IsTaskRun is_run;
  unsigned int timer;
  unsigned int timeslice_len;
  ListObj timeslice_task_list;
} TimesilceTaskObj;

void timesLiceExec(void);
void timesLiceTick(void);
void timesLiceTaskInit(TimesilceTaskObj* obj, void (*task_hdl)(void),
                       unsigned int id, unsigned int timeslice_len);
void timesLiceTaskAdd(TimesilceTaskObj* obj);
void timesLiceTaskDel(TimesilceTaskObj* obj);
unsigned int timesLiceGetTaskTimesLiceLen(TimesilceTaskObj* obj);
unsigned int timesLiceGetTaskNum(void);
unsigned char timesliceTaskIsExist(TimesilceTaskObj* obj);

#endif  // TIMESILCE_H
